<template>
	<div style="width: 1050px; margin: 0 auto; margin-top: 20px;margin-bottom:90px">
		<el-steps
			:active="active"
			finish-status="success"
		>
			<el-step title="航班查询"></el-step>
			<el-step title="航班选择"></el-step>
			<!-- <el-step title="航班概况"></el-step> -->
			<el-step title="资料填写"></el-step>
			<el-step title="支付"></el-step>
			<el-step title="出票"></el-step>
		</el-steps>
		<div class="content">
			<step1
				v-if="active == 1"
				@nextstep="nextstep"
				@prevstep="prevstep"
				@changedate="changedate($event)"
			/>
			<!-- <step2
				v-if="active == 2"
				@nextstep="nextstep"
				@prevstep="prevstep"
				@changedate="changedate($event)"
			/> -->
			<step3
				v-if="active == 2"
				:list="list"
				@prevstep="prevstep"
				@nextstep="nextstep"
				@changedate="changedate($event)"
			/>
			<step4
				v-if="active == 3"
				@prevstep="prevstep"
				@nextstep="nextstep"
				@changedate="changedate($event)"
			/>
			<step5
				v-if="active == 4"
				@prevstep="prevstep"
				@nextstep="nextstep"
				@changedate="changedate($event)"
			/>
		</div>
		<el-button
			type="success"
			plain
			@click="nextstep"
		>下一步</el-button>
		<el-button
			type="success"
			plain
			@click="prevstep"
		>上一步</el-button>
	</div>
</template>

<script>
	import step1 from "./step1";
	// import step2 from "./step2";
	import step3 from "./step3";
	import step4 from "./step4";
	import step5 from "./step5";
	export default {
		components: {
			step1,
			step3,
			step4,
			step5,
		},
		data() {
			return {
				active: 1,
				aircraftInfoId: null,
				list: null,
			};
		},
		methods: {
			nextstep() {
				if (this.active < 4) {
					this.active += 1;
				} else if (this.active == 4) {
					this.$router.push({ path: '/ddzx' })
					// location.reload();
				}
			},
			prevstep() {
				if (this.active > 0) {
					this.active -= 1;
					if (this.active == 0) {
						this.$router.push({
							path: "/"
						});
					}
				}
			},
			changedate(data) {
				if (data) {
					if (data.step == "1") {
						this.tempdate1 = data.data;
					}
					if (data.step == "2") {
						this.tempdate2 = data.data;
					}
					if (data.step == "3") {
						this.tempdate3 = data.data;
					}
					if (data.step == "4") {
						this.tempdate3 = data.data;
					}
					if (data.step == "5") {
						this.tempdate3 = data.data;
					}
				}
			},
		},
		mounted() {
			let stepId = this.$route.query.stepId;
			if (stepId == 1) {
				this.active = 2;
				this.aircraftInfoId = this.$route.query.aircraftInfoId;
			}
			if (this.active == 2) {
				this.$http.get("http://localhost/api/core/aircraftInfo/get/" + this.aircraftInfoId).then(response => {
					if (response.data.code == 0) {
						console.log("aaaaaaaaaaaaaa", response.data.data.aircraftInfo);
						this.list = response.data.data.aircraftInfo;
					}
				})
			}
		},
	}
</script>

<style scoped>
</style>
